package com.cat.model.dao.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.cat.model.common.model.common.DeviceInfoVO;
import com.cat.model.common.model.common.PhoneChcekCodeVO;
import com.cat.model.common.model.common.UserInfoVO;
import com.cat.model.common.model.common.UserPhoneVO;
import com.cat.model.common.model.common.UserTokenVO;

/**
 * 使用注解的时候一定要将XXXMapper注册一下，跟XML配置namespace一样
 * 这里面主要到DefaultSessionFactory类中注册
 * @author Administrator
 *
 */
public interface UserInfoMapper {

	@Select("select * from device_info where deviceId=#{deviceId}")
	public DeviceInfoVO getDeviceInfo(@Param("deviceId") String deviceId);

	@Select("select * from phone_check_code where phoneNo=#{phoneNo}")
	public PhoneChcekCodeVO getPhoneCheckCode(@Param("phoneNo") String phoneNo);
	
	@Select("select * from user_phone where phoneNo=#{phoneNo}")
	public UserPhoneVO getUserPhone(@Param("phoneNo") String phoneNo);
	
	@Select("select * from user_phone where userId=#{userId}")
	public UserPhoneVO getUserPhoneByUserId(@Param("userId") long userId);
	
	@Select("select * from user_info where id=#{id}")
	public UserInfoVO getUserInfo(@Param("id") long id);
	
	@Select("select * from user_token where userId=#{userId}")
	public UserTokenVO getUserToken(@Param("userId") long userId);
	
	@Select("select * from user_token where token=#{token}")
	public UserTokenVO getUserTokenByToken(@Param("token") String token);
	
	@Select("select * from user_token where refreshToken=#{refreshToken}")
	public UserTokenVO getUserTokenByRefreshToken(@Param("refreshToken") String refreshToken);
	
}
